home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / DIAGTOOL / JPRDY101.ZIP;1 / APPCOPY.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-08-19  |  1.6 KB  |  68 lines

  1. {$I-}
  2. Program AppCopy;
  3.  
  4. uses Dos;
  5.  
  6.   function CopyFile(Source,Target:String):BOOLEAN;
  7.  
  8.   const
  9.     BufSize = 512;
  10.  
  11.   type
  12.     rec = array[1..512] of char;
  13.  
  14.   var
  15.     I : longint;
  16.     R : rec;
  17.     S,T : file of rec;
  18.     Time : longint;
  19.  
  20.   begin
  21.     Assign(S,Source);
  22.     Assign(T,Target);
  23.     Reset(S);
  24.     ReWrite(T);
  25.     for I := 1 to FileSize(S) do
  26.     begin
  27.       Read(S,R);
  28.       Write(T,R)
  29.     end; {for}
  30.     GetFtime(S,Time);
  31.     SetFTime(T,Time);
  32.     Close(S);
  33.     Close(T);
  34.     CopyFile := (IOResult = 0)
  35.   end; {CopyFile}
  36.  
  37. var
  38.   Drive : string;
  39.   Path : string;
  40.  
  41. begin
  42.   if ParamStr(2) = '' then
  43.   begin
  44.     WriteLn('Please specify a drive and directory, like this:');
  45.     WriteLn('APPCOPY C TEMP');
  46.     WriteLn
  47.   end {then}
  48.   else
  49.   begin
  50.     Drive := ParamStr(1);
  51.     Path := ParamStr(2);
  52.     WriteLn('Copying files...');
  53.     CopyFile('test.txt',Drive+':\'+Path+'\test1.txt');
  54.     CopyFile('test.txt',Drive+':\'+Path+'\test2.txt');
  55.     CopyFile('test.txt',Drive+':\'+Path+'\test3.txt');
  56.     CopyFile('test.txt',Drive+':\'+Path+'\test4.txt');
  57.     CopyFile('test.txt',Drive+':\'+Path+'\test5.txt');
  58.     CopyFile('test.txt',Drive+':\'+Path+'\test6.txt');
  59.     CopyFile('test.txt',Drive+':\'+Path+'\test7.txt');
  60.     CopyFile('test.txt',Drive+':\'+Path+'\test8.txt');
  61.     if not CopyFile('big.txt',Drive+':\temp2\big.txt') then
  62.       WriteLn('File copy error.')
  63.     else
  64.       WriteLn('Done.');
  65.     WriteLn('Press [ENTER] to erase the files just copied after disk I/O is complete.');
  66.     ReadLn
  67.   end {else}
  68. end. {AppCopy}